<template>
  <div class="codes">
    <h3 style="text-align: center;">{{title}}</h3>
    <div style="text-align: center;font-size: 13px;color: #999;">
      <span>{{time}}</span>
      <span class="fbdw">{{regionName}}</span>
    </div>
    <div v-if="name" style="margin: 15px;display: flex;">
      <div style="width: 85px;">负责人：</div>
      <div style="flex: 1;">{{name}}</div>
    </div>
    <div v-if="serviceContent" style="margin: 15px;display: flex;">
      <div style="width: 85px;">服务内容：</div>
      <div style="flex: 1;">{{serviceContent}}</div>
    </div>
    <div style="margin: 15px;overflow-x: hidden;" v-html="description"></div>
    <div v-if="remark" style="margin: 15px;">备注：{{remark}}</div>
  </div>
</template>
<script>
// const isDev = process.env.NODE_ENV === 'development';
const isDev = false;
export default {
  data() {
    return {
      description: "",
      title: "",
      regionName:"",
      time: "",
      remark: "",
      name: "",
      serviceContent: ""
    };
  },
  created() {
    this.setTitle(this.$route.query.title);
    if (this.$route.query.title == "格格帮办") {
      let content = JSON.parse(this.$route.query.content);
      this.title = content.title;
      this.regionName = content.regionName;
      this.time = content.updateTime;
      this.remark = content.remark;
      this.description = this.replaceImgs(content.description);
      this.description = this.description.replace(
        /\s(width:)/g,
        " width: 100%"
      );
    }

    if (this.$route.query.title == "网格帮帮团") {
      let content = JSON.parse(this.$route.query.content);
      this.title = content.teamName;
      this.time = content.updateTime;
      this.regionName = content.regionName;
      this.remark = content.remark;
      this.name = content.name;
      this.serviceContent = content.serviceContent;
    }
  },
  methods: {
    replaceImgs(htmlText) {
      return htmlText.replace(
        /\s(src=")/g,
        ' width="100%" height="150px" src="http://www.hkqwgb.cn:8080'
      );
      // replaceText = htmlText.replace(
      //   /\s(width:)/g,
      //   ' width: 100%'
      // );
      // this.detData.description = replaceText;
      // console.log("replaceText", replaceText);
    }
  }
};
</script>
<style lang="scss" scoped>
@import "~@/smobile.scss";
.codes {
  .fbdw{
    margin-left: 15px;
    font-size: $sm-font-size-sm;
    background: #e5b03e;
    padding: 3px 6px;
    border-radius: 12px;
    color: #ffffff;
  }

}
</style>